using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class ReturnReasonMap : EntityTypeConfiguration<ReturnReason>
	{
		public ReturnReasonMap()
		{
			// Primary Key
			this.HasKey(t => t.ReasonID);

			// Properties
			this.Property(t => t.ReasonID)
				.IsRequired()
				.HasMaxLength(4);
				
			this.Property(t => t.TypeID)
				.IsRequired()
				.IsFixedLength()
				.HasMaxLength(1);
				
			this.Property(t => t.Reason)
				.IsRequired()
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("ReturnReason");
			this.Property(t => t.ReasonID).HasColumnName("ReasonID");
			this.Property(t => t.TypeID).HasColumnName("TypeID");
			this.Property(t => t.Reason).HasColumnName("Reason");
			this.Property(t => t.SortOrder).HasColumnName("SortOrder");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
			this.Property(t => t.CategoryId).HasColumnName("CategoryId");
		}
	}
}

